package work3;

import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class MyAspect3 {

	@Pointcut(value="execution(* work3.UserDaoImpl.*(..))")
	public void pointCut() {}
	
	@Before(value="pointCut()")
	public void before() {
		System.out.println("注解配置Aspect前置通知——开启事务");
	}
	
	@AfterReturning(value="pointCut()")
	public void after() {
		System.out.println("注解配置Aspect后置通知——提交事务");
	}
	
	@AfterThrowing(value="pointCut()")
	public void exception() {
		System.out.println("注解配置Aspect异常通知——事务回滚");
	}	
	
}

